package com.student.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.student.dao.StudentDao;
import com.student.entity.StudentInfo;

public class StudentInfoServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    public StudentInfoServlet() {
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
				StudentDao studao = new StudentDao(); 
		// 查询报名的信息
				request.setCharacterEncoding("utf-8");
				String stuNo = request.getParameter("stuNo");
				StudentInfo stuInfo = studao.queryStudentBySno(stuNo);
				
				request.setAttribute("student", stuInfo);
				
				
				
				response.setCharacterEncoding("utf-8");
				response.setContentType("text/html; charset=UTF-8");
				PrintWriter out = response.getWriter();

		response.getWriter().append("Served at: ").append(request.getContextPath());
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
